package com.shizhanzhe.zxbapp.widget;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.shizhanzhe.zxbapp.R;


/**
 * Created by YJ on 2018/10/24.
 */
public class MakeMoneyDialog extends Dialog {
    ImageView iv_dwyx;
    ImageView iv_close;
    Context mcontext;
    private MakeMoneyListener mListener;

    public void setListener(MakeMoneyListener listener) {
        mListener = listener;
    }

    public MakeMoneyDialog(@NonNull Context context) {
        super(context, R.style.my_dialog);
        mcontext=context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (null != getWindow()) {
            WindowManager.LayoutParams lp = getWindow().getAttributes();
            lp.dimAmount = 0.0f;
            getWindow().setAttributes(lp);
        }
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        setContentView(R.layout.dialog_make_money);
        iv_dwyx = findViewById(R.id.iv_dwyx);
        iv_close = findViewById(R.id.iv_close);
        iv_close.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        iv_dwyx.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mListener.checktrue();
            }
        });
        setCanceledOnTouchOutside(true);
    }
    public void setImg(String imgurl){
        Glide.with(mcontext).load(imgurl).into(iv_dwyx);
        iv_close.setVisibility(View.GONE);
    }
    public void setInto(){
        Glide.with(mcontext).load(R.mipmap.tx_bg).into(iv_dwyx);
        iv_close.setVisibility(View.GONE);
    }
    public interface MakeMoneyListener{
        void checktrue();
    }
}
